<template>
    <div>
        <table class="table">
            <thead>
                <tr>
                    <td>房型编号</td>
                    <td>
                        <select v-model="obj.houseTypeID" name="" id="">
                            <option  value=""></option>
                            <option value=""></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>房间定金</td>
                    <td>
                        <input v-model="obj.price" type="text">
                    </td>
                </tr>
                <tr>
                    <td>入住人</td>
                    <td>
                        <input v-model="obj.name" type="text">
                    </td>
                </tr>
                <tr>
                    <td>房间数量</td>
                    <td>
                        <input v-model="obj.houserNumber" type="text">
                    </td>
                </tr>
                <tr>
                    <td>早餐数量</td>
                    <td>
                        <input v-model="obj.breakfastNumber" type="text">
                    </td>
                </tr>
                <tr>
                    <td>最大入住人数</td>
                    <td>
                        <input v-model="obj.personNumber" type="text">
                    </td>
                </tr>
                <tr>
                    <td>是否删除</td>
                    <td>
                        <input v-model="obj.isDelete" type="checkbox">选中为删除
                    </td>
                </tr>
                <tr>
                    <td>是否投放状态</td>
                    <td>
                        <input v-model="obj.state" type="checkbox">选中为投放
                    </td>
                </tr>
                <tr>
                    <td>排序</td>
                    <td>
                        <input v-model="obj.sort" type="text">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="button" value="添加" @click="add" class="btn">
                    </td>
                </tr>
            </thead>
        </table>
    </div>
</template>

<script setup lang="ts">
import router from '@/router';
import axios from 'axios';
import { ref } from 'vue';

const obj=ref({
    "id": 0,
    "houseTypeID": 0,
    "price": 0,
    "name": "string",
    "houserNumber": 0,
    "breakfastNumber": 0,
    "personNumber": 0,
    "isDelete": true,
    "state": true,
    "sort": 0
})
const add=()=>{
    axios.post("https://localhost:7275/api/HousePrice/AddHousePrice",obj.value).then(res=>{
        if(res.data>0){
            alert('添加成功')
            router.push("ShowPrice");
        }
        else{
            alert('添加失败')
        }
    })
}
</script>

<style scoped>

</style>